<extend name="template/base_index" />

<block name="area_header">
    <style type="text/css">
        td{
            text-align: center;
        }
        td pre{
            HEIGHT: 160PX;
            width:480px;
        }
        .object-code{
            width:480px;
            HEIGHT: 160PX;
            display: block;
            margin:0 auto;
            word-wrap: break-word;
            text-align: left;
            overflow: scroll;
            overflow-x: hidden;
        }
    </style>
</block>

<block name="area_body">
    {:W('Menus/topbar')}
    <div class="admin-main container-fluid">
        {:W('Menus/left')}
        <div class="admin-main-content">
            {:W('Menus/breadcrumb')}

            <div class="h4">支付单上报</div>
            <form class="pay_info_form" action="{:U('Admin/Zjport/uploadPay')}">
                <input type="hidden" name="order_code" value="{$order.order_code}" />
                <a href="javascript:history.back(-1);" class="btn btn-default btn-sm"><i class="fa fa-reply"></i>返回</a>
                <br>

                <div class="form-group">
                    <!--<label>订单编号</label>-->
                    <!--<div class=" ">{$order.order_code}</div>-->
                    <label>上报订单编号</label>
                    <div class=" ">{$order.pay_code}</div>
                    <label>支付方式</label>
                    <div class=" ">
                        {$order.pay_type|getPayType}
                        <div class="help-block">暂 只支持支付宝</div>
                    </div>
                </div>
                <div class="form-group">
                    <label>上报海关</label>
                    <div class=" ">
                        <select name="haiguan" class="form-control input-normal">
                            <option value="HANGZHOU" selected>杭州海关</option>
                            <!--<option value="HENAN">河南海关</option>-->
                            <!--<option value="ZHENGZHOU">郑州海关</option>-->
                            <!--<option value="GUANGZHOU">广州海关</option>-->
                            <!--<option value="CHONGQING">重庆海关</option>-->
                            <!--<option value="NINGBO">宁波海关</option>-->
                            <!--<option value="SHENZHEN">深圳海关</option>-->
                            <!--<option value="SHANGHAI">上海海关</option>-->
                        </select>
                    </div>
                </div>

                <div class="text-center">
                    <a target-form="pay_info_form" href="{:U('Admin/Zjport/uploadPay')}" data-loading-text="正在上报中..."  class="no-refresh J_upload ajax-post btn btn-sm btn-primary">上报支付单数据</a>
                </div>
                <div class="js_info text-center">

                </div>
            </form>
            <div class="" style="padding: 10px">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <td>序号</td>
                            <td>上报参数</td>
                            <td>返回结果</td>
                            <td>上报时间</td>
                        </tr>
                    </thead>
                    <volist name="list" id="vo">
                        <tr>
                            <td>{$key+1}</td>
                            <td ><span class="object-code" title="{$vo.upload_content}">{$vo.upload_content}</span></td>
                            <td ><span class="object-code" title="{$vo.upload_content}">{:dump($vo['result'])}</span></td>
                            <td>{:date("Y-m-d H:i:s",$vo['upload_time'])}</td>
                        </tr>
                    </volist>
                </table>
                <div>{$show}</div>
            </div>
        </div>

        <!-- END admin-main-content -->
    </div>
    <!-- END admin-main-->
</block>

<block name="area_footer">

    <script type="text/javascript">

        function upload(){
            var order_code = "{$order.order_code}";

//            $.ajax({
//                url:"{:U('Admin/Zjport/uploadPay')}",
//                data:{order_code:order_code},
//                type:"POST",
//                beforeSend:function(){
//                    $(".J_upload").button("loading");
//                }
//            }).always(function(){
//                $(".J_upload").button("reset");
//            }).done(function(json){
//                console.log(json);
//                if(json.status){
//
//                    console.log("info=",json);
//
//                    $(".js_info").text(info.data);
//                    $(".js_info").addClass("text-success");
//
//                }else{
//                    $(".js_info").text(json.info);
//                    $.scojs_message(json.info , $.scojs_message.TYPE_ERROR);
//                }
//            }).fail(function(){
//                $.scojs_message("上报失败!请刷新后重试!", $.scojs_message.TYPE_ERROR);
//            });

        }

        $(function(){

            $(".J_upload").click(function(){

                upload();

            });

        })


    </script>

</block>